#!/usr/bin/env Python
# -*- coding: UTF-8 -*-

from django.contrib.sitemaps import Sitemap
from blogmaker.blog.models import Entry, Tag

class PostsSitemap(Sitemap):
    changefreq="weekly"
    priority = 0.5
    
    def items(self):
        return Entry.objects.filter(active=True).order_by('-pub_date')
    
    def lastmod(self, obj):
        return obj.pub_date
    
class OtherSitemapPages(Sitemap):
    "Other pages to be included in the sitemap"
    priority = 0.5
    urls = (
            ( '/', 'daily'),
            )
    def items(self):
        return self.urls
                
    def changefreq(self,obj):
        return obj[1]
    
    def location(self,obj):
        return obj[0]
    
sitemaps = {
    'posts': PostsSitemap,
    'others': OtherSitemapPages,
}    